﻿using System;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.Coding4Fun.TweetCraft.Tray
{
    internal static class ExceptionExtensions
    {
        [SuppressMessage("Microsoft.Performance", "CA1811", Justification = "Extension method is only called in Debug builds.")]
        public static string GetDetailedMessage(this Exception exception)
        {
            if (exception == null)
                throw new ArgumentNullException("exception");

            return exception.InnerException != null ?
                String.Concat(exception.Message, " ", exception.InnerException.GetDetailedMessage()) : exception.Message;
        }
    }
}
